﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DataAccessLayer;
using Entities;
using System.Data;
namespace BusinessLogicLayer
{
    public class HoaDonBanSachBO
    {
        private HoaDonBanSachDAL dal;
        public HoaDonBanSachBO(){
            try
            {
                dal = new HoaDonBanSachDAL();
            }
            catch (Exception e)
            {
                throw new BusinessLogicException();
            }
        }
        public DataTable layDanhSachHoaDon()
        {
            DataTable s = null;
            try
            {
                s = dal.layDanhSachHoaDon();
            }
            catch (Exception)
            {
                throw;
            }
            return s;
        }
        public String GetLastID()
        {
            String kq = null;
            try
            {
                kq = dal.GetLastID();
            }
            catch (Exception)
            {
                return kq;
                throw;
            }
            return kq;
        }

        public int InsertHoaDon (HoaDon HD)
        {
            int kq = 0;
            try
            {
                kq = dal.InsertHoaDon(HD);
            }
            catch (Exception)
            {
                return kq;
                throw;
            }
            return kq;
        }

        public double GetTongTienCuaKhachHangMuaTrongThang(string thang, string nam, int maKhachHang)
        {
            double kq = 0;
            try
            {
                kq = dal.GetTongTienCuaKhachHangMuaTrongThang(thang, nam, maKhachHang);
            }
            catch (Exception)
            {
                return kq;
                throw;
            }
            return kq;
        }
        public int DeleteHoaDon(string maHoaDon)
        {
            int dt = 0;
            try
            {
                dt = dal.DeleteHoaDon(maHoaDon);
                return dt;
            }
            catch (Exception)
            {
                return dt;
                throw;
            }

        }
    }
}
